const { 
  fixBabelImports, 
  override, 
  addWebpackAlias,
  addDecoratorsLegacy
} = require('customize-cra')
const { resolve } = require('path')
/* 路径 */
const cwd = process.cwd()
const AppSrc = resolve(cwd,'src')

module.exports = override(
  /* antd的按需加载 */
  fixBabelImports('import', { libraryName: "antd", style: "css" }),
  /* 路径别名 */
  addWebpackAlias({
    '@': AppSrc,
    "components": resolve(AppSrc, 'components'),
    "pages": resolve(AppSrc, 'pages'),
    "router": resolve(AppSrc, 'router'),
    "api": resolve(AppSrc, 'api'),
    'assets': resolve(AppSrc, 'assets'),
    'utils': resolve(AppSrc, 'utils')
  }),
  /* 修改器语法 */
  addDecoratorsLegacy()
)